<html>
    <head>
        <link rel="stylesheet" type="text/css" href="/css/searchDocsCategory.css" />
        <script src="/lib/js/jquery.min.js"></script>
        <link href="/lib/pnotify/pnotify.custom.min.css"  rel="stylesheet" />
        <link href="/lib/bootstrap/bootstrap.css"  rel="stylesheet" />
        <script src="/lib/bootstrap/bootstrap.min.js"></script>
        <script src="/lib/pnotify/pnotify.custom.min.js"></script>
        <link href="/lib/loading/css/loading.css"  rel="stylesheet" />
        <script src="/lib/loading/js/loading.js"></script>
        <script src="/js/util.js"></script>
    </head>
    <body>
        <div class="searchDocsCategoryBox">
                <div class="addDocsTitle"><i class="fa fa-file-text-o fa-lg"></i>接口文档分类列表<a href="/index"><span><i class="fa fa-mail-reply-all  fa-lg"></i>返回首页</span></a></div>
                <div class="docsCategoryListBox">
                    <div class="docsCategoryListHeader">
                        <div class="docsCategoryListHeaderItem" style="width:10%;">分类ID</div>
                        <div class="docsCategoryListHeaderItem" style="width:20%;">分类名称</div>
                        <div class="docsCategoryListHeaderItem" style="width:70%;">操作</div>
                    </div>
                    <div class="docsCategoryListContent">
                        
                        <% for(var i=0;i<categoryData.length;i++){ %>
                        <div class="docsCategoryListContentItem">
                                <div class="docsCategoryListHeaderItem" style="width:10%;"><%- categoryData[i].dc_id %></div>
                                <div class="docsCategoryListHeaderItem" style="width:20%;"><%- categoryData[i].dc_name %></div>
                                <div class="docsCategoryListHeaderItem" style="width:70%;">
                                        <a href="/editDocsCategory?id=<%- categoryData[i].dc_id %>"><span class="categoryEdit">编辑</span></a>
                                    <span class="categoryDelete" id="<%- categoryData[i].dc_id %>">删除</span>
                                </div>
                            </div>
                        <% } %>
                    </div>
                </div>
        </div>
    </body>
    <script>
        $(function(){

            $(".categoryDelete").click(function(){

                var dc_id = $(this).attr("id");

                POP.confirm("删除确认","您确定要删除该分类么?",function(){

                    POP.startLoading();

                    HTTP.post("/docs/deleteCategory", { dc_id : dc_id }, (rs) => {

                        POP.endLoading();
                        POP.success("提示信息", "恭喜您，分类删除成功");

                        setTimeout(function(){
                            location.reload();
                        },1000)

                    })

                });

            });
        })
    </script>
</html>
